Skip to content

Conversation

@mlohvinenko
Copy link
Owner

This pull request migrates the activities data from in-memory storage to MongoDB, adds new activities, and introduces participant management features. The backend now supports registering and unregistering students for activities, and the frontend displays participants with the ability to remove them interactively. Styling enhancements have been added for the participants section.

Backend: Data migration and participant management

  • Migrated activities data from in-memory storage to MongoDB, including connection setup and usage of activities_collection for all activity queries. [1] [2]
  • Added backend endpoints for registering and unregistering participants from activities, with proper error handling for duplicate registrations and missing participants.
  • Created src/init_db.py to initialize the database with a comprehensive set of activities and participants.

Frontend: Participant display and interaction

  • Updated the frontend to display a list of participants for each activity, including a delete icon for removing participants.
  • Implemented frontend logic to handle participant removal via the new unregister endpoint and refresh the activities list after changes. [1] [2]

Styling improvements

  • Added CSS to style the participants section, participant list, delete icons, and empty state for no participants. [1] [2]

@mlohvinenko mlohvinenko requested a review from Copilot September 25, 2025 21:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request migrates the activities data from in-memory storage to MongoDB and adds participant management functionality. The changes introduce the ability to register and unregister students from activities with proper validation and error handling.

  • Migrated activities data from in-memory dictionary to MongoDB with comprehensive activity seeding
  • Added backend endpoints for participant registration and unregistration with duplicate/missing participant validation
  • Implemented frontend participant display with interactive removal functionality

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

File Description
src/app.py Migrated from in-memory storage to MongoDB, expanded initial activities data, and added registration/unregistration endpoints
src/static/app.js Added participant display with delete functionality and refresh logic after operations
src/static/styles.css Added styling for participant sections, lists, delete icons, and empty states
src/init_db.py Database initialization script to seed MongoDB with initial activities data

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +92 to +100
.participants-list {
list-style-type: disc;
margin-left: 20px;
margin-bottom: 0;
padding-left: 0;

list-style: none;
padding-left: 0;
}
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSS properties are contradictory and redundant. Lines 93-94 set list-style-type: disc and margin-left: 20px, but lines 98-99 immediately override them with list-style: none and padding-left: 0. Remove the redundant properties on lines 93-94.

Copilot uses AI. Check for mistakes.
Comment on lines +102 to +105
.participant-item {
display: flex;
align-items: center;
}
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .participant-item selector is duplicated with different properties. These should be combined into a single rule block to avoid confusion and potential specificity issues.

Copilot uses AI. Check for mistakes.
Comment on lines +119 to +123
.participant-item {
margin-bottom: 4px;
color: #333;
font-size: 15px;
}
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .participant-item selector is duplicated with different properties. These should be combined into a single rule block to avoid confusion and potential specificity issues.

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +38
? `<ul class="participants-list" style="list-style: none; padding-left: 0;">
${details.participants
.map(
(participant) =>
`<li class="participant-item" style="display: flex; align-items: center;">
<span>${participant}</span>
<span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}" style="cursor: pointer; margin-left: 8px; color: #d00; font-weight: bold;">&#10006;</span>
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline styles are being used when CSS classes already exist for the same properties. Remove the inline styles and rely on the existing CSS classes .participants-list, .participant-item, and .delete-icon to maintain consistency and improve maintainability.

Suggested change
? `<ul class="participants-list" style="list-style: none; padding-left: 0;">
${details.participants
.map(
(participant) =>
`<li class="participant-item" style="display: flex; align-items: center;">
<span>${participant}</span>
<span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}" style="cursor: pointer; margin-left: 8px; color: #d00; font-weight: bold;">&#10006;</span>
? `<ul class="participants-list">
${details.participants
.map(
(participant) =>
`<li class="participant-item">
<span>${participant}</span>
<span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}">&#10006;</span>

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +38
? `<ul class="participants-list" style="list-style: none; padding-left: 0;">
${details.participants
.map(
(participant) =>
`<li class="participant-item" style="display: flex; align-items: center;">
<span>${participant}</span>
<span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}" style="cursor: pointer; margin-left: 8px; color: #d00; font-weight: bold;">&#10006;</span>
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline styles are being used when CSS classes already exist for the same properties. Remove the inline styles and rely on the existing CSS classes .participants-list, .participant-item, and .delete-icon to maintain consistency and improve maintainability.

Suggested change
? `<ul class="participants-list" style="list-style: none; padding-left: 0;">
${details.participants
.map(
(participant) =>
`<li class="participant-item" style="display: flex; align-items: center;">
<span>${participant}</span>
<span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}" style="cursor: pointer; margin-left: 8px; color: #d00; font-weight: bold;">&#10006;</span>
? `<ul class="participants-list">
${details.participants
.map(
(participant) =>
`<li class="participant-item">
<span>${participant}</span>
<span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}">&#10006;</span>

Copilot uses AI. Check for mistakes.
@mlohvinenko mlohvinenko merged commit 9c785e9 into main Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants